package org.rslai.autotest.core.page.impl;

import org.rslai.autotest.core.page.AbstractHelper;
import org.rslai.autotest.core.page.Navigate;

/**
 * Navigate处理方法
 * @author rslai
 */
public class NavigateImpl extends AbstractHelper implements Navigate {

	@Override
	public void get_Page(String uri) {
		super.driver().get(this.conf.getWebsiteBaseUrl() + uri);

		super.sleep(this.conf.getDriverPlaybackSpeed()); // 设置回放速度
	}

	@Override
	public void get_Page(String baseUrl, String uri) {
		super.driver().get(baseUrl + uri);

		super.sleep(this.conf.getDriverPlaybackSpeed()); // 设置回放速度
	}

	@Override
	public void back() {
		super.driver().navigate().back();

		super.sleep(this.conf.getDriverPlaybackSpeed()); // 设置回放速度
	}

	@Override
	public void forward() {
		super.driver().navigate().forward();

		super.sleep(this.conf.getDriverPlaybackSpeed()); // 设置回放速度
	}

	@Override
	public void refresh() {
		super.driver().navigate().refresh();

		super.sleep(this.conf.getDriverPlaybackSpeed()); // 设置回放速度
	}

	@Override
	public void to(String url) {
		super.driver().navigate().to(url);

		super.sleep(this.conf.getDriverPlaybackSpeed()); // 设置回放速度
	}

	@Override
	public void close() {
		super.driver().close();

		super.sleep(this.conf.getDriverPlaybackSpeed()); // 设置回放速度
	}

	@Override
	public String getLocation() {
		return super.driver().getCurrentUrl();
	}

	@Override
	public String getTitle() {
		return super.driver().getTitle();
	}
	
	@Override
	public String getPageSource() {
		return super.driver().getPageSource();
	}

}
